import {onBeforeUnmount, onMounted, reactive, ref} from "vue";

export default function(){
    const count=ref(0)

    let point = reactive({
        x: 0,
        y: 0
    })
    const add=()=>{
        count.value++
    }
    const usePoint = (event:any)=>{
        point.x = event.x
        point.y = event.y
    }
    onMounted(() => {
        window.addEventListener('click', usePoint)
    })
    onBeforeUnmount(() => {
        window.removeEventListener('click', usePoint)
    })

    return {
        count,point, //data
        add //method
    }

}